<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>短信查询</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 确保适当的绘制和触屏缩放 -->
    <link rel="stylesheet" href="{$url_css}/bootstrap.min.css" type="text/css">
    <script type="text/javascript" src="{$url_js}jquery-1.12.0.min.js"></script>
    <script type="text/javascript" src="{$url_js}calendar/WdatePicker.js"></script>
</head>
<body>
    <div class="container" style="width:96%">
        <form action="?do=Default" method="get">
            <table class="table table-bordered table-striped" align="center">
                <tr>
                    <td colspan="5">查询条件</td>
                </tr>
                <tr>
                    <td class="form-group" style="width: 300px;">
                        <div class="input-group">
                            <div class="input-group-addon">手机号</div>
                            <input type="text" class="form-control" name="Mobile" placeholder="手机号" value="{if $Mobile}{$Mobile}{/if}">
                        </div>
                    </td>
                    <td class="form-group" style="width: 200px;">
                        <div class="input-group">
                            <div class="input-group-addon">分类</div>
                            <input type="text" class="form-control" name="Type" placeholder="分类ID" value="{if $Type}{$Type}{/if}">
                        </div>
                    </td>
                    <td class="form-group" style="width: 270px;">
                        <div class="input-group">
                            <div class="input-group-addon">开始时间</div>
                            <input class="form-control" id="start_time" name="start_time" type="text" onFocus="WdatePicker({literal}{startDate:'%y-%M-%d 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'end_time\')}'}{/literal});" value="{$start_time}" readonly="">
                        </div>
                    </td>
                    <td class="form-group" style="width: 270px;">
                        <div class="input-group">
                            <div class="input-group-addon">结束时间</div>
                            <input class="form-control" id="end_time" name="end_time" type="text" onFocus="WdatePicker({literal}{startDate:'%y-%M-%d 23:59:59',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'start_time\')}'}{/literal});" value="{$end_time}" readonly="">
                        </div>
                    </td>
                    <td>
                        <input type="submit" value="搜索" class="btn btn-primary" />
                        <input type="button" onclick="get_msg_remain(this)" value="查询短信余额" class="btn btn-default" />&nbsp;
                        <span id="msg_count" style="color:blue; display: none">查询中...</span>
                    </td>
            </table>
        </form>

        <table class="table table-bordered table-striped" align="center">
            <thead>
                <tr>
                    <td colspan="7"><strong>显示记录总数：{$total} 条</strong></td>
                </tr>
            </thead>
            <tbody>
                <tr align="center">
                    <td width="2%">手机号</td>
                    <td width="2%">分类</td>
                    <td width="4%">是否发送</td>
                    <td width="5%">ip地址</td>
                    <td width="5%">验证码</td>
                    <td width="5%">是否使用</td>
                    <td width="12%">操作时间</td>
                </tr>
                {if !empty($data)}
                    {foreach $data as $v}
                        <tr align="center">
                            <td>{$v.Mobile|html}</td>
                            <td>{$v.Type}</td>
                            <td>{if {$v.Status} == 0}未发送{else}已发送{/if}</td>
                            <td>{$v.Ip}</td>
                            <td>{$v.Flag}</td>
                            <td>{if {$v.Used} == 0}未使用{else}已使用{/if}</td>
                            <td>{$v.CreateTime}</td>
                        </tr>
                    {/foreach}
                {/if}

                {if $pagination != ''}
                    <tr><td colspan="7" align="right">{$pagination}</td></tr>
                {/if}
            </tbody>
        </table>
    </div>
<script type="text/javascript">
    {literal}
    function get_msg_remain(obj)
    {
        $(obj).prop('disabled', true);
        $('#msg_count').html('查询中...').show();

        $.get('?do=RemainMsg', function(json) {
            if (json.count) {
                $('#msg_count').html('短信余额: ' + json.count);
            } else {
                $('#msg_count').html('查询失败');
            }
            $(obj).prop('disabled', false);
        }, 'json');
    }
    {/literal}
</script>
</body>
</html>
    